<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button>btn1</button>
<button>btn2</button>
<button>btn3</button>
<button>btn4</button>
<button>btn5</button>
</body>
<script>
    //写重复申请
    /*
        var a = 10;
        var a = 20;
        console.log(a);
    */
    /*
        let a = 10;
        let a = 20;
        console.log(a);
    */
    //无块级作用域
    /*
        {
            var a = 10;
        }
        console.log(a);
    */
    /*
        {
            let a = 10;
        }
        console.log(a);
    */
    /*
        var i = 10;
        if(i == 10){
            var i = 120;
            console.log(i);
        }
        console.log(i);
    */
    /*
        let i = 10;
        if(i==10){
            let i=120;
            console.log(i);
        }
        console.log(i);
    */
    /*
        var btns = document.getElementsByTagName('button');
        for(var i=0;i<btns.length;i++){
            btns[i].addEventListener('click', function(){
                console.log(i);
            });
        }
    */
    /*
        var btns = document.getElementsByTagName('button');
        for(let i=0;i<btns.length;i++){
            btns[i].addEventListener('click', function(){
                console.log(i);
            });
        }
    */
    /*
        var a = 10;
        function show(){
            var a = 20;
            console.log(a);
        }
        show();
        console.log(a);
    */
    /*
        var i = 10;
        if (i == 10) {
            (function (i) {
                i = 120;
                console.log(i);
            })(i);
        }
        console.log(i);
    */
    /*
        var btns = document.getElementsByTagName('button');
        for (var i = 0; i < btns.length; i++) {
            (function (btns, i) {
                btns[i].addEventListener('click', function () {
                    console.log(i);
                });
            })(btns, i);
        }
    */
    //变量提升
    /*
        console.log(a);
        var a = 10;
    */
    /*
        console.log(a);
        let a = 10;
    */
</script>
</html>